<include file="Public/head" xmlns="http://www.w3.org/1999/html"/>
<include file="Public/common_header" />
<link type="text/css" rel="stylesheet" href="{:get_style_cdnurl()}paimai/yunying/css/cashier.css" />
<script type="text/javascript">
    $(function(){
        $("input").placeholder();
        if (navigator.userAgent.indexOf("Safari") > -1) {
            $("input").css("lineHeight","normal !important");
        };
    });
</script>
<div class="mian">
    <include file="Public/sidebar" menu="cggl.cgdlb"  />
    <div class="mianR">
        <div class="listBox">
            <input type="hidden" name="id" value="{$arr.purchase_order.id}">
            <div class="car_info">
                <table border="1" width="100%" class="purchase-list">
                    <thead>
                    <tr>
                        <td width="33%">采购单号</td>
                        <td width="33%">采购单状态</td>
                        <td width="33%">采购单金额</td>
                    </tr>
                    </thead>
                    <tbody>
                    <tr>
                        <td width="33%">{$arr.purchase_order.purchase_order_nu}</td>
                        <td width="33%">{$arr.purchase_order.status_name}</td>
                        <td width="33%">{$arr.purchase_order.amount}元</td>
                    </tr>
                    </tbody>
                </table>
                <table border="1" width="100%" style="margin-top:10px;">
                    <tbody>
                    <tr>
                        <td colspan="4" style="background-color:#c1c1c1;font-size:14px;"><span>车主信息</span></td>
                    </tr>
                    <tr>
                        <td width="11%" style="color:#898b8a;">车主类型</td>
                        <td width="39%">{$arr.car_owner.owner_type_name}</td>
                        <if condition="$arr['car_owner']['owner_type'] eq 1">
                            <td width="11%" style="color:#898b8a;">车主姓名</td>
                            <td width="39%">{$arr.car_owner.seller_name}</td>
                        <else />
                            <td width="11%" style="color:#898b8a;">公司名称</td>
                            <td width="39%">{$arr.car_owner.seller_name}</td>
                        </if>
                    </tr>
                    <tr>
                        <if condition="$arr['car_owner']['owner_type'] eq 1">
                            <td width="11%" style="color:#898b8a;">联系电话</td>
                            <td colspan="3">{$arr.car_owner.phone}</td>
                        <else />
                            <td width="11%" style="color:#898b8a;">联系人姓名</td>
                            <td width="39%">{$arr.car_owner.contact_person}</td>
                            <td width="11%" style="color:#898b8a;">联系电话</td>
                            <td width="39%">{$arr.car_owner.phone}</td>
                        </if>
                    </tr>
                    </tbody>
                </table>
                <table border="1" width="100%" style="margin:10px 0;">
                    <tbody>
                    <tr>
                        <td colspan="4" style="background-color:#c1c1c1;font-size:14px;">
                            <span>车辆信息</span>
                            <span style="float: right;margin-right: 20px;"><a style="color: #0000FF;text-decoration: underline;" href="/Car/report/car_id/{$arr.car_info.car_id}" target="_blank">检测报告</a></span>
                        </td>
                    </tr>
                    <tr>
                        <td width="11%" style="color:#898b8a;">车型</td>
                        <td width="39%">{$arr.car_info.model_show}</td>
                        <td width="11%" style="color:#898b8a;">排放标准</td>
                        <td width="39%">{$arr.car_info.emission}</td>
                    </tr>
                    <tr>
                        <td style="color:#898b8a;">初登日期</td>
                        <td>{$arr.car_info.first_reg_date}</td>
                        <td style="color:#898b8a;">颜色</td>
                        <td>{$arr.car_info.car_color}</td>
                    </tr>
                    <tr>
                        <td style="color:#898b8a;">表显里程</td>
                        <td>{$arr.car_info.pointer_mileage}万公里</td>
                        <td style="color:#898b8a;">车况级别</td>
                        <td>{$arr.car_info.car_level}</td>
                    </tr>
                    <tr>
                        <td style="color:#898b8a;">车辆注册地</td>
                        <td>{$arr.car_info.reg_city}</td>
                        <td style="color:#898b8a;">车架号</td>
                        <td>{$arr.car_info.vin}</td>
                    </tr>
                    <tr>
                        <td style="color:#898b8a;">车牌号</td>
                        <td>{$arr.car_info.plate}</td>
                        <td style="color:#898b8a;">过户限制</td>
                        <td>{$arr.car_info.transfer_limit}</td>
                    </tr>
                    <tr>
                        <td style="color:#898b8a;">渠道来源</td>
                        <td>
                            {$arr.car_info.comefrom}                                                                                                                </td>
                        <td style="color:#898b8a;">所在地</td>
                        <td>{$arr.car_info.location_area_str}</td>
                    </tr>
                    </tbody>
                </table>
               <!-- <h3 class="yonghu">流程跟踪</h3> 下版本做该功能
                <div class="flow-tracing">
                    <ul class="clearfix">
                        <if condition="1 eq 1"> &lt;!&ndash; 已付款的判断还没有做好 &ndash;&gt;
                            <li class="single-curr">
                                <span></span>
                                已付款{$arr.order_info.is_lock}
                                <i></i>
                            </li>
                        </if>

                        &lt;!&ndash;已付款后&ndash;&gt;
                        <if condition="$arr['order_info']['is_lock'] eq 1"> &lt;!&ndash;判断是否锁定 &ndash;&gt;
                            <li class="single-close">
                                <span></span>拍单锁定<i></i>
                            </li>
                        </if>

                        <if condition="$arr['order_info']['status'] eq 12">  &lt;!&ndash;判断是否关闭&ndash;&gt;
                            <li class="single-close">
                                <span></span>拍单关闭<i></i>
                            </li>
                        </if>

                        <if condition="$arr['order_info']['return_check_status'] egt 3">
                            <li class="single-curr">
                                <span></span>已回车<i></i>
                            </li>

                        <else/>
                            <li>
                                <span></span>已回车<i></i>
                            </li>
                        </if>

                        &lt;!&ndash;已付款&ndash;&gt;
                        <if condition="$arr['order_info']['is_lock'] eq 1"> &lt;!&ndash;判断是否锁定 &ndash;&gt;
                            <li class="single-close">
                                <span></span>拍单锁定<i></i>
                            </li>
                        </if>

                        <if condition="$arr['order_info']['status'] eq 12">  &lt;!&ndash;判断是否关闭&ndash;&gt;
                            <li class="single-close">
                                <span></span>拍单关闭<i></i>
                            </li>
                        </if>



                        <if condition="1 eq 1"> &lt;!&ndash;同样已收款的判断还没有做好&ndash;&gt;
                            <li>
                                <span></span>已收款<i></i>
                            </li>
                        </if>

                        <if condition="$arr['order_info']['is_lock'] eq 1"> &lt;!&ndash;判断是否锁定 &ndash;&gt;
                            <li class="single-close">
                                <span></span>拍单锁定<i></i>
                            </li>
                        </if>

                        <if condition="$arr['order_info']['status'] eq 12">  &lt;!&ndash;判断是否关闭&ndash;&gt;
                            <li class="single-close">
                                <span></span>拍单关闭<i></i>
                            </li>
                        </if>


                        <if condition="$arr['order_info']['check_car_status'] egt 3">
                            <li class="single-curr">
                                <span></span>已验车<i></i>
                            </li>
                        <else/>
                            <li>
                                <span></span>已验车<i></i>
                            </li>
                        </if>

                        <if condition="$arr['order_info']['is_lock'] eq 1"> &lt;!&ndash;判断是否锁定 &ndash;&gt;
                            <li class="single-close">
                                <span></span>拍单锁定<i></i>
                            </li>
                        </if>

                        <if condition="$arr['order_info']['status'] eq 12">  &lt;!&ndash;判断是否关闭&ndash;&gt;
                            <li class="single-close">
                                <span></span>拍单关闭<i></i>
                            </li>
                        </if>



                        <if condition="$arr['order_info']['status'] eq 9">
                            <li class="single-curr">
                                <span></span>待过户<i></i>
                            </li>

                            <if condition="$arr['order_info']['is_lock'] eq 1"> &lt;!&ndash;判断是否锁定 &ndash;&gt;
                                <li class="single-close">
                                    <span></span>拍单锁定<i></i>
                                </li>
                            </if>

                            <if condition="$arr['order_info']['status'] eq 12">  &lt;!&ndash;判断是否关闭&ndash;&gt;
                                <li class="single-close">
                                    <span></span>拍单关闭<i></i>
                                </li>
                            </if>

                        <elseif condition="$arr['order_info']['status'] egt 11" />
                            <li class="single-curr">
                                <span></span>已过户
                            </li>

                            <if condition="$arr['order_info']['is_lock'] eq 1"> &lt;!&ndash;判断是否锁定 &ndash;&gt;
                                <li class="single-close">
                                    <span></span>拍单锁定<i></i>
                                </li>
                            </if>

                            <if condition="$arr['order_info']['status'] eq 12">  &lt;!&ndash;判断是否关闭&ndash;&gt;
                                <li class="single-close">
                                    <span></span>拍单关闭<i></i>
                                </li>
                            </if>

                        <else/>
                            <li>
                                <span></span>待过户<i></i>
                            </li>

                            <if condition="$arr['order_info']['is_lock'] eq 1"> &lt;!&ndash;判断是否锁定 &ndash;&gt;
                                <li class="single-close">
                                    <span></span>拍单锁定<i></i>
                                </li>
                            </if>

                            <if condition="$arr['order_info']['status'] eq 12">  &lt;!&ndash;判断是否关闭&ndash;&gt;
                                <li class="single-close">
                                    <span></span>拍单关闭<i></i>
                                </li>
                            </if>


                            <li>
                                <span></span>已过户
                            </li>
                        </if>
                        <?php $arr['order_info']['is_lock'] = 1;?>
                        <if condition="$arr['order_info']['is_lock'] eq 1"> &lt;!&ndash;判断是否锁定 &ndash;&gt;
                            <li class="single-close">
                                <span></span>拍单锁定
                            </li>
                        </if>

                        <?php $arr['order']['status'] = 12;?>
                        <if condition="$arr['order_info']['status'] eq 12">  &lt;!&ndash;判断是否关闭&ndash;&gt;
                            <li class="single-close">
                                <span></span>拍单关闭
                            </li>
                        </if>

                    </ul>
                </div>-->
                <div class="yongBtn">
                    <?php if(I('get.action') == 'do'):?>
                        <!-- 采购单未锁定时切不是订单时 -->
                        <if condition="($arr['purchase_order']['is_lock'] neq 1) and ($arr['order_info']['is_other_channel_deal'] neq 1)">
                            <if condition="$arr['purchase_order']['status'] eq 1">
                                <?php if( ($arr['order_info']['status'] == 9 or $arr['order_info']['status'] == 10) && $arr['order_info']['is_dispute'] && ($arr['transfer_info']['result'] != 4)):?>
                                    <input type="button" class="quxiao" onclick="dispute('{$arr.purchase_order.id}');" value="争议">
                                <?php endif;?>
                                <?php if($arr['order_info']['status'] < 11 && ($arr['transfer_info']['result'] != 4)):?>
                                    <input type="button" class="quxiao" onclick="save_default();" value="违约">
                                <?php endif;?>
                            </if>
                        </if>

                        <if condition="$params['lock'] eq 1"> <!-- 权限判断 -->
                            <?php if($arr['purchase_order']['status'] != 2):?> <!--当采购单时锁定状态时，不显示锁定 -->
                                <input type="button" class="quxiao" onclick="lock();" value="锁定">
                            <?php endif;?>
                        </if>

                        <if condition="$params['un_lock'] eq 1">
                            <?php if($arr['purchase_order']['status'] == 2):?> <!-- 当采购单是锁定状态时，才显示 -->
                                <input type="button" class="quxiao" onclick="unLock();" value="解锁">
                            <?php endif;?>
                        </if>
                    <?php endif;?>
                    <input type="button" class="quxiao" onclick="cancel();" value="关闭">
                </div>
            </div>
        </div>
    </div>
    <div class="clear"></div>
    </div>
</div>
<script>
    // 发起争议
    function dispute(purchase_order_nu) {
        window.location.href = '/PurchaseOrder/dispute/id/' + purchase_order_nu;
    }

    //取消
    function cancel() {
        window.location.href = '/PurchaseOrder/purchase_order_list';
    }

    //提交违约
    function save_default() {
        var purchase_order_id = $("input[name='id']").val();
        var param = {};
        param = {
            'id':purchase_order_id,
        };

        var btn_obj = $(this);
        btn_obj.val("提交中...").attr("disabled",'disabled');
        $.post("/PurchaseOrder/saveDefault",param,function(data){
            if(data.code!=200){
                shibai_alert(data.msg,1500);
                btn_obj.val("确定").removeAttr("disabled style");
                return false;
            }
            btn_alert("提交成功",1500,function () {
                cancel();
            });
        },"json");
    }
    
    function lock() {
        var purchase_order_id = $("input[name='id']").val();
        var param = {};
        param = {
            'id':purchase_order_id,
        };

        var btn_obj = $(this);
        btn_obj.val("提交中...").attr("disabled",'disabled');
        $.post("/PurchaseOrder/lockPurchaseOrder",param,function(data){
            if(data.code!=200){
                shibai_alert(data.msg,1500);
                btn_obj.val("确定").removeAttr("disabled style");
                return false;
            }
            btn_alert("提交成功",1500,function () {
                cancel();
            });
        },"json");
    }

    function unLock() {
        var purchase_order_id = $("input[name='id']").val();
        var param = {};
        param = {
            'id':purchase_order_id,
        };

        var btn_obj = $(this);
        btn_obj.val("提交中...").attr("disabled",'disabled');
        $.post("/PurchaseOrder/unlockPurchaseOrder",param,function(data){
            if(data.code!=200){
                shibai_alert(data.msg,1500);
                btn_obj.val("确定").removeAttr("disabled style");
                return false;
            }
            btn_alert("提交成功",1500,function () {
                cancel();
            });
        },"json");
    }
    
    //取消
    function cancel() {
        window.location.href = '/PurchaseOrder/purchase_order_list';
    }
</script>
<include file="Public/foot" />